package com.itheima.controller;


import com.itheima.domain.po.Address;
import com.itheima.service.impl.AddressServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2023-10-28
 */
@RestController
@RequestMapping("/address")
@RequiredArgsConstructor
public class AddressController {

    private final AddressServiceImpl addressService;

    @GetMapping("/{id}")
    public List<Address>getByUserId(@PathVariable Long id){
        return addressService.lambdaQuery()
                .eq(Address::getUserId,id)
                .list();
    }
}
